package com.qzsoft.zhjd.materiel.modules.materieldata.entity;

import java.math.BigDecimal;
import java.util.Date;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.qzsoft.jeemis.common.validator.group.AddGroup;
import com.qzsoft.jeemis.common.validator.group.UpdateGroup;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;

/**
 * @ClassName MaterielDataEntity
 * @Description 物料数据
 * @author linhuawei
 * @since 2021-09-01
 */
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
@Builder
@ToString
@TableName("n_materiel_data")
public class MaterielDataEntity {

    /**
     * 主键
     */
    @TableId(type = IdType.ASSIGN_UUID)
    private String id;

    /**
     * 基地编码
     */
    private String baseCode;

    /**
     * 地磅设备主键
     */
    @NotBlank(groups = {AddGroup.class, UpdateGroup.class}, message = "地磅不可为空")
    private String deviceCode;

    /**
     * 物料唯一标识
     */
    @NotBlank(groups = {AddGroup.class, UpdateGroup.class}, message = "物料不可为空")
    private String materielItemId;

    /**
     * 操作员主键
     */
    @NotBlank(groups = {AddGroup.class, UpdateGroup.class}, message = "操作员不可为空")
    private String operatorId;

    /**
     * 供应商主键
     */
    private String supplierId;

    /**
     * 用料项目/单位主键
     */
    private String projectId;

    /**
     * 磅单编号
     */
    private String weightCode;

    /**
     * 过磅类型：0=收料，1=发料
     */
    @NotBlank(groups = {AddGroup.class, UpdateGroup.class}, message = "过磅类型不可为空")
    private String weightType;

    /**
     * 数据类型（采购、销售等）
     */
    @NotBlank(groups = {AddGroup.class, UpdateGroup.class}, message = "收/发料类型不可为空")
    private String weightDataType;

    /**
     * 数据来源：0称重，1补录
     */
    private String weightDataSource;

    /**
     * 偏差：0=正常，1=超负差，2=超正差
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String deviationType;
    
    /**
     * 偏差率
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private BigDecimal deviationRatio;
    
    /**
     * 正差值
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private BigDecimal upperLimit;
    
    /**
     * 负差值
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private BigDecimal lowerLimit;

    /**
     * 毛重/t
     */
    @NotNull(groups = {AddGroup.class, UpdateGroup.class}, message = "毛重不可为空")
    private BigDecimal grossWeight;

    /**
     * 皮重/t
     */
    @NotNull(groups = {AddGroup.class, UpdateGroup.class}, message = "皮重不可为空")
    private BigDecimal tareWeight;

    /**
     * 扣重占比
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private BigDecimal deductionRatio;

    /**
     * 扣重/t
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private BigDecimal deductionWeight;

    /**
     * 净重/t
     */
    @NotNull(groups = {AddGroup.class, UpdateGroup.class}, message = "净重不可为空")
    private BigDecimal netWeight;

    /**
     * 实际重量
     */
    @NotNull(groups = {AddGroup.class, UpdateGroup.class}, message = "实际重量不可为空")
    private BigDecimal weight;
    
    /**
     * 转换系数
     */
    private BigDecimal convRate;

    /**
     * 实际数量
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private BigDecimal quantity;

    /**
     * 运单编号
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String waybillCode;

    /**
     * 运单重量/t
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private BigDecimal waybillWeight;

    /**
     * 运单数量
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private BigDecimal waybillQuantity;

    /**
     * 运单图片
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String waybillImage;

    /**
     * 进磅时间
     */
    @NotNull(groups = {AddGroup.class, UpdateGroup.class}, message = "进磅时间不可为空")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private Date entryTime;

    /**
     * 出磅时间
     */
    @NotNull(groups = {AddGroup.class, UpdateGroup.class}, message = "出磅时间不可为空")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private Date exitTime;

    /**
     * 车牌号
     */
    @NotNull(groups = {AddGroup.class, UpdateGroup.class}, message = "车牌号不可为空")
    private String carNumber;

    /**
     * 是否废弃：0=否，1=是
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private Integer disable;

    /**
     * 废弃原因
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String disableReason;

    /**
     * 进磅图片1
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String entryImageOne;

    /**
     * 进磅图片2
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String entryImageTwo;

    /**
     * 进磅图片3
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String entryImageThree;

    /**
     * 进磅图片4
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String entryImageFour;

    /**
     * 出磅图片1
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String exitImageOne;

    /**
     * 出磅图片2
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String exitImageTwo;

    /**
     * 出磅图片3
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String exitImageThree;

    /**
     * 出磅图片4
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String exitImageFour;

    /**
     * 备注
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String remark;
    
    /**
     * 是否修改，0否，1是
     */
    private Integer changed;
    
    /**
     * 打印次数
     */
    private Integer printTimes;

    /**
     * 添加人
     */
    @TableField(fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NEVER)
    private Long creator;

    /**
     * 添加时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NEVER)
    private Date createDate;

    /**
     * 修改人
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updater;

    /**
     * 修改时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateDate;

}
